﻿<?xml version="1.0" encoding="utf-8" ?>
<c2eventsheet>
    <!--All the 'name' attributes are ignored by Construct 2 - they are there for readability only.-->
    <name>Main Event Sheet</name>
    <events>
        <variable constant="1" name="SCALEMULT" static="0" type="number">0.02</variable>
        <variable constant="1" name="STARTSIZE" static="0" type="number">5</variable>
        <variable constant="0" name="SpawnLocation" static="0" type="text"></variable>
        <variable constant="0" name="Score" static="0" type="number">0</variable>
        <comment>Spawn new enemies</comment>
        <event-block>
            <conditions>
                <condition id="-2" name="On start of layout" type="System" />
            </conditions>
            <actions>
                <action id="-10" name="Set value" type="hero">
                    <param id="0" name="Instance variable">Size</param>
                    <param id="1" name="Value">STARTSIZE</param>
                </action>
                <action id="9" name="Set scale" type="hero">
                    <param id="0" name="Scale">hero.Size * SCALEMULT</param>
                </action>
                <action id="4" name="Preload" type="Bubble">
                    <param id="0" name="Audio file">bubble1</param>
                </action>
            </actions>
        </event-block>
        <event-block>
            <conditions>
                <condition id="-6" name="Every X seconds" type="System">
                    <param id="0" name="Interval (seconds)">0.1</param>
                </condition>
            </conditions>
            <actions>
                <action id="-3" name="Create object" type="System">
                    <param id="0" name="Object to create">enemy</param>
                    <param id="1" name="Layer">0</param>
                    <param id="2" name="X">-50</param>
                    <param id="3" name="Y">-50</param>
                </action>
                <action behavior="Bullet" id="0" name="Set speed" type="enemy">
                    <param id="0" name="Speed">random(50,300)</param>
                </action>
                <action id="-9" name="Set value" type="System">
                    <param id="0" name="Variable">SpawnLocation</param>
                    <param id="1" name="Value">choose(&quot;T&quot;,&quot;B&quot;,&quot;L&quot;,&quot;R&quot;)</param>
                </action>
                <action id="-10" name="Set value" type="enemy">
                    <param id="0" name="Instance variable">Size</param>
                    <param id="1" name="Value">random(hero.Size - 5, hero.Size + 1)</param>
                </action>
                <action id="9" name="Set scale" type="enemy">
                    <param id="0" name="Scale">enemy.Size * SCALEMULT</param>
                </action>
            </actions>
            <sub-events>
                <event-block>
                    <conditions>
                        <condition id="-14" name="Compare variable" type="System">
                            <param id="0" name="Variable">SpawnLocation</param>
                            <param id="1" name="Comparison">0</param>
                            <param id="2" name="Value">&quot;T&quot;</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="-3" name="Set position" type="enemy">
                            <param id="0" name="X">random(0,LayoutWidth)</param>
                            <param id="1" name="Y">0</param>
                        </action>
                        <action behavior="Bullet" id="3" name="Set angle of motion" type="enemy">
                            <param id="0" name="Angle">random(45,135)</param>
                        </action>
                    </actions>
                </event-block>
                <event-block>
                    <conditions>
                        <condition id="-14" name="Compare variable" type="System">
                            <param id="0" name="Variable">SpawnLocation</param>
                            <param id="1" name="Comparison">0</param>
                            <param id="2" name="Value">&quot;B&quot;</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="-3" name="Set position" type="enemy">
                            <param id="0" name="X">random(0,LayoutWidth)</param>
                            <param id="1" name="Y">LayoutHeight</param>
                        </action>
                        <action behavior="Bullet" id="3" name="Set angle of motion" type="enemy">
                            <param id="0" name="Angle">random(225,315)</param>
                        </action>
                    </actions>
                </event-block>
                <event-block>
                    <conditions>
                        <condition id="-14" name="Compare variable" type="System">
                            <param id="0" name="Variable">SpawnLocation</param>
                            <param id="1" name="Comparison">0</param>
                            <param id="2" name="Value">&quot;L&quot;</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="-3" name="Set position" type="enemy">
                            <param id="0" name="X">0</param>
                            <param id="1" name="Y">random(0,LayoutHeight)</param>
                        </action>
                        <action behavior="Bullet" id="3" name="Set angle of motion" type="enemy">
                            <param id="0" name="Angle">random(-45,45)</param>
                        </action>
                    </actions>
                </event-block>
                <event-block>
                    <conditions>
                        <condition id="-14" name="Compare variable" type="System">
                            <param id="0" name="Variable">SpawnLocation</param>
                            <param id="1" name="Comparison">0</param>
                            <param id="2" name="Value">&quot;R&quot;</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="-3" name="Set position" type="enemy">
                            <param id="0" name="X">LayoutWidth</param>
                            <param id="1" name="Y">random(0,LayoutHeight)</param>
                        </action>
                        <action behavior="Bullet" id="3" name="Set angle of motion" type="enemy">
                            <param id="0" name="Angle">random(135,225)</param>
                        </action>
                    </actions>
                </event-block>
            </sub-events>
        </event-block>
        <event-block>
            <conditions>
                <condition id="0" name="On collision with another object" type="enemy">
                    <param id="0" name="Object">hero</param>
                </condition>
            </conditions>
            <actions>
                <action id="0" name="Play" type="Bubble">
                    <param id="0" name="Audio file">bubble1</param>
                    <param id="2" name="Loop">0</param>
                    <param id="3" name="Volume">0</param>
                    <param id="1" name="Tag (optional)">&quot;bubble&quot;</param>
                </action>
            </actions>
            <sub-events>
                <event-block>
                    <conditions>
                        <condition id="-8" name="Compare two values" type="System">
                            <param id="0" name="First value">enemy.Width</param>
                            <param id="1" name="Comparison">4</param>
                            <param id="2" name="Second value"> hero.Width</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="-10" name="Set value" type="hero">
                            <param id="0" name="Instance variable">Size</param>
                            <param id="1" name="Value">STARTSIZE</param>
                        </action>
                        <action id="-9" name="Set value" type="System">
                            <param id="0" name="Variable">Score</param>
                            <param id="1" name="Value">0</param>
                        </action>
                        <action behavior="Flash" id="0" name="Flash" type="hero">
                            <param id="0" name="&apos;On&apos; time">0.1</param>
                            <param id="1" name="&apos;Off&apos; time">0.1</param>
                            <param id="2" name="Duration">1.0</param>
                        </action>
                    </actions>
                </event-block>
                <event-block>
                    <conditions>
                        <condition id="-22" name="Else" type="System" />
                    </conditions>
                    <actions>
                        <action id="-11" name="Add to" type="hero">
                            <param id="0" name="Instance variable">Size</param>
                            <param id="1" name="Value">0.25</param>
                        </action>
                        <action id="-10" name="Add to" type="System">
                            <param id="0" name="Variable">Score</param>
                            <param id="1" name="Value">1</param>
                        </action>
                    </actions>
                </event-block>
                <event-block>
                    <conditions />
                    <actions>
                        <action id="0" name="Set text" type="score">
                            <param id="0" name="Text">Score</param>
                        </action>
                        <action id="-9" name="Destroy" type="enemy" />
                        <action id="9" name="Set scale" type="hero">
                            <param id="0" name="Scale">hero.Size * SCALEMULT</param>
                        </action>
                    </actions>
                </event-block>
            </sub-events>
        </event-block>
    </events>
</c2eventsheet>
